<?php

class Mac_Db_Query_Insert extends Mac_Db_Query_Abstract
{
    private $table = null;
    
    private $values = array();
    
    private function __construct ($table)
    {
        $this->table = $table;
    }
    
    /**
     * Initialize the query
     */
    public static function into ($table)
    {
        return new self($table);
    }
    
    public function value ($field, $value)
    {
        $this->values[$field] = Mac_Db_Helper::prepareValue($value);
        return $this;
    }
    
    public function __toString()
    {
        $req = 'INSERT INTO '.$this->table.' (';
        $req .= implode(', ', array_keys($this->values));
        $req .=') VALUES (';
        $req .= implode(', ', $this->values);
        $req .= ')';
        return $req;
    }
}